# import  pandas as pd
# data = pd.read_excel('D:/hhxx2/aj/能量表.xlsx.')
# dict={'时间':data['时间'],
#     'ajwldl2.YC456':data['ajwldl2.YC456'],
#
#
#            }
# dataframe = pd.DataFrame(dict)
# year = []
# startyear = dataframe['时间'][0][:4]
# # endyear = dataframe['时间'][len(dataframe['时间']) - 1][:4]
# endyear=2020
# # endyear=2022
# # print(startyear,endyear,type(startyear))
# if (startyear == endyear):
#     year.append(startyear)
# else:
#     i = int(endyear) - int(startyear)
#     for j in range(0, i + 1):
#         year.append(int(startyear) + j)
# # print(year,type(year))
# month = []
# startmonth = dataframe['时间'][0][5:7]
# endmonth = dataframe['时间'][len(dataframe['时间']) - 1][5:7]
# month.append(startmonth)
# #目前只是2019年，先这么写
# for i in range(1,int(endmonth)-int(startmonth)):
#     month.append(str(int(startmonth)+i))
# month.append(endmonth)
# # month=['06','7','8','09']
# # print(month,type(year))
# day = []
# startdate = dataframe['时间'][0][8:10]
# enddate = dataframe['时间'][len(dataframe['时间']) - 1][8:10]
# day.append(startdate)
# for i in range(0,len(month)-2):
#     day.append('1')
# day.append(enddate)
#
#
# print(month)
# print(day)
# print(year)
import  pandas as pd
data = pd.read_excel('D:/hhxx2/aj/能量表.xlsx.')
dict={'时间':data['时间'],
    'ajwldl2.YC456':data['ajwldl2.YC456'],


           }
dataframe = pd.DataFrame(dict)

startyear = dataframe['时间'][0][:4]
endyear = dataframe['时间'][len(dataframe['时间']) - 1][:4]

# endyear=2022
# print(startyear,endyear,type(startyear))

# else:
#     i = int(endyear) - int(startyear)
#     for j in range(0, i + 1):
#         year.append(int(startyear) + j)
# print(year,type(year))
month = []
startmonth = dataframe['时间'][0][5:7]
endmonth = dataframe['时间'][len(dataframe['时间']) - 1][5:7]
if (int(startyear)== int(endyear)):
    month.append(startmonth)
#目前只是2019年，先这么写
    for i in range(1,int(endmonth)-int(startmonth)):
        month.append(str(int(startmonth)+i))
    month.append(endmonth)
else:
    i = int(endyear) - int(startyear)
    if(int(startmonth)==12):
        month.append(startmonth)

    else:
        i=12-int(startmonth)
        for j in range(0,i+1):
            month.append(str(int(startmonth)+j))
    if(int(endyear) - int(startyear)==1):
        pass
    else:
        for j in range(0,int(endyear) - int(startyear)-1):
            for num in range(1,13):
                month.append(str(num))

    if(int(endmonth)==1):
        month.append(endmonth)
    else:

        for j in range(1,int(endmonth)+1):
            month.append(str(j))
# month=['06','7','8','09']
# print(month,type(year))
day = []
startdate = dataframe['时间'][0][8:10]
enddate = dataframe['时间'][len(dataframe['时间']) - 1][8:10]
day.append(startdate)
for i in range(0,len(month)-2):
    day.append('1')
day.append(enddate)
year=[]
if(int(startyear)==int(endyear)):
    for i in range(0,int(endmonth)-int(startmonth)+1):


        year.append(endyear)
else:
    i = int(endyear) - int(startyear)
    if (int(startmonth) == 12):
        year.append(startyear)

    else:
        i = 12 - int(startmonth)
        for j in range(0, i + 1):
            year.append(startyear)
    if (int(endyear) - int(startyear) == 1):
        pass
    else:
        for j in range(0, int(endyear) - int(startyear) - 1):
            for num in range(1, 13):
                year.append(str(int(startyear)+j+1))

    if (int(endmonth) == 1):
        year.append(str(endyear))
    else:

        for j in range(1, int(endmonth) + 1):
            year.append(str(endyear))
print(month,len(month))
print(day,len(day))
print(year,len(year))

# data = pd.read_excel('D:/hhxx2/aj/能量表.xlsx.')
# dict={'时间':data['时间'],
#     'ajwldl2.YC456':data['ajwldl2.YC456'],
#
#
#            }
# dataframe = pd.DataFrame(dict)
# year = []
# startyear = dataframe['时间'][0][:4]
# endyear = dataframe['时间'][len(dataframe['时间']) - 1][:4]
# # endyear=2022
# # print(startyear,endyear,type(startyear))
# if (startyear == endyear):
#     year.append(startyear)
# else:
#     i = int(endyear) - int(startyear)
#     for j in range(0, i + 1):
#         year.append(str(int(startyear) + j))
# # print(year,type(year))
# month = []
# startmonth = dataframe['时间'][0][5:7]
# endmonth = dataframe['时间'][len(dataframe['时间']) - 1][5:7]
# month.append(startmonth)
# #目前只是2019年，先这么写
# for i in range(1,int(endmonth)-int(startmonth)):
#     month.append(str(int(startmonth)+i))
# month.append(endmonth)
# # month=['06','7','8','09']
# # print(month,type(year))
# day = []
# startdate = dataframe['时间'][0][8:10]
# enddate = dataframe['时间'][len(dataframe['时间']) - 1][8:10]
# day.append(startdate)
# for i in range(0,len(month)-2):
#     day.append('1')
# day.append(enddate)
# iflastm=False
# # print(date)
# # day = ['1', '4']
# dataS = []
# for i in range(0, len(dataframe['时间'])):
#     dataS.append(dataframe['时间'][i][0:10])
